package guo.listen;

import guo.entity.User;
import guo.event.UserEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author: gsq
 * @description: TODO
 * @date: 2024/6/5 9:50
 * @version: 1.0
 */
@Component
public class UserEventListen {

    @Async
    @EventListener(UserEvent.class)
    public void solveEventUserListener(UserEvent event) throws InterruptedException {
        User user = event.getUser();
        System.out.println("监听到了user信息 "+user);
        Thread.sleep(5000);
        System.out.println("user休眠结束");
    }
}
